<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>手机商品市场</title>

<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

</head>

<body>

<div class="row">
   <div id="vf_loadRight" class="col-xs-12">
	<!-- PAGE CONTENT BEGINS -->
                             <div class="widget-body">
		</div>
                             <div class="widget-body  col-xs-12">
			<div id="div_condition_search" class="widget-main row">
				<div class="col-xs-8 pull-left">
					<input type="text" id="brand" name="brand" value="${brand!}" class="" placeholder="手机品牌" />
					<input type="text" id="model" name="model" value="${model!}" class="" placeholder="手机型号" />
					
					<a id="a_condition_search" href="javascript:void(0);" class="btn btn-sm btn-info" onclick="condition_search('${ctx}/goods/getGoodsList')">
							<i class="glyphicon glyphicon-search"></i> ${langMap['lang.global.common.button.query']}
					</a>
				</div>	
				<div class="col-xs-4 pull-right">
				    <#if session.master.manager=='1'>
					<a href="${ctx}/goods/gotoSave" class="btn btn-sm btn-info pull-right" openMode="rightPage"> 
						<i class="glyphicon glyphicon-plus bigger-110"></i>
						${langMap['lang.global.common.button.add']}
					</a>
					<a href="${ctx}/goods/gotoImportGoods"  class="btn btn-sm btn-info" openMode="rightPage"> 
						<i class="glyphicon glyphicon-import bigger-110"></i>
						${langMap['lang.global.common.button.import']}
					</a>
					<!-- 
					<a href="${ctx}/master/gotoSave" class="btn btn-sm btn-info" openMode="rightPage"> 
						<i class="glyphicon glyphicon-export bigger-110"></i>
						${langMap['lang.global.common.button.export']}
					</a>
					 -->
				</#if>
			  </div>
			</div>
		</div>
		<form id="form_query" action="${ctx}/goods/getGoodsList" method="post">
		<!-- 列表开始 -->
		<div class="table-responsive">
			<table id="wew" name="wew" border="2" width="100%">
				   <tbody>
					   <#list pageObj as obj>
					    	<#if obj_index%3==0>
						   <tr id="ttttextrrrr_${obj['goodsid']}"  >
					    	</#if>
						   <!-- 
						       <td class="center checked">
						          	<label>
						          		<input id="master_obj_${obj['goodsid']}" type="checkbox" class="ace"/>
						          		<span class="lbl"></span>
								    </label>
							   </td>
							    -->
						    	<td style="font-size:12px;">
							    <#list headMap.keySet() as mkey>
							        <#if mkey=='pirce'>
							        	<!-- <td class="col-xs-${(2/headMap.size())?int}"></span> ${obj[mkey]!}￥</td> -->
							        	 ${obj[mkey]!}￥
							        <#elseif mkey=='stock'>
							        	<#if (obj[mkey]!)== '0'>
							        		<span class="red"><i class="glyphicon glyphicon-warning-sign"></i></span>缺货
							        	<#else>
							        		有货
							        	</#if>
				   			    	<#else>
				   			    		<#if (obj[mkey]!)?length lt 6>   
											${obj[mkey]!}
										<#else> 
										     ${obj[mkey][0..10]}...
										</#if>
					   			    </#if>
					   	 	   </#list>
			   			    </td>
					   	 	   <!-- 
							   <#list headMap.keySet() as mkey>
							        <#if mkey=='pirce'>
							        	<td class="col-xs-${(2/headMap.size())?int}" style="width:10%;"></span> ${obj[mkey]!}￥</td>
							        <#elseif mkey=='stock'>
							        	<#if (obj[mkey]!)== '0'>
							        		<td class="col-xs-${(2/headMap.size())?int}" style="width:10%;"><span class="red"><i class="glyphicon glyphicon-warning-sign"></i></span>缺货</td>
							        	<#else>
							        		<td class="col-xs-${(2/headMap.size())?int}" style="width:10%;">有货</td>
							        	</#if>
				   			    	<#else>
				   			    		<#if (obj[mkey]!)?length lt 6>   
											<td class="col-xs-${(3/headMap.size())?int}" style="width:15%;">${obj[mkey]!}</td>
										<#else> 
										     <td class="col-xs-${(3/headMap.size())?int}" title="${obj[mkey]}" style="width:15%;">${obj[mkey][0..10]}...</td>
										</#if>
					   			    </#if>
					   	 	   </#list>
					   	 	    -->
					   	 	   <td>
									<div>
										<#if session.master.manager=='1'>
										<a id="mas_" class="green" href="${ctx}/goods/gotoUpdate/${obj.goodsid!}" openMode="rightPage" title="修改">
											<i class="glyphicon glyphicon-pencil bigger-130" ></i>
										</a>
										<a id="mas_list_del" class="red" href="javascript:void(0);" title="删除" onclick="if(confirm('确定要删除吗？')){ajaxRefresh('${ctx}/goods/deleteGoods/${obj.goodsid!}','${ctx}/goods/getGoodsList');}">
											<i class="glyphicon glyphicon-trash bigger-130" ></i>
										</a>
										</#if>
										<!-- 后续扩展的操作按钮 -->
										<#if (obj['stock']!)!= '0'>
										<input id="min_${obj['goodsid']}" goodsid="${obj['goodsid']}" onClick="" type="button" value="-"  style="height:20px;"/>  
										<input id="text_box_${obj['goodsid']}" name="pirce_sum" pirce="${obj['pirce']}" size="1" type="text" value="1"  style="height:20px;"/>  
										<input id="add_${obj['goodsid']}" goodsid="${obj['goodsid']}" type="button" value="+"  style="height:20px;"/>  
										<!-- 总价：<label id="total_${obj['goodsid']}"></label>  -->
										<a id="buyGoods_${obj['goodsid']}" class="blue" style="cursor:pointer;" goodsid="${obj['goodsid']}"  openMode="rightPage" title="加入购物车">
											<i class="glyphicon glyphicon-saved" ></i>
										</a>
										</#if>
									</div>
								</td>
					   	 	   <#if obj_index%3==2>
								</tr>
							</#if>
					   </#list>
				   </tbody>
				</table>
			<!-- 
				<table id="wew" name="wew" class="table table-striped table-bordered table-hover full-left" >
				   <thead>
					   <tr>
					         <th>
					        <#list headMap.keySet() as mkey>
						   		${headMap.get(mkey)}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					   	    </#list>
					   	    </th>
					   	    <th>${langMap['lang.global.common.table.operate']}</th>
					   </tr>
				   </thead>
				   <tbody>
					   <#list pageObj as obj>
						   <tr id="ttttextrrrr_${obj['goodsid']}" >
						    	<td class="col-xs-${(2/headMap.size())?int}" style="width:100%;">
							    <#list headMap.keySet() as mkey>
							        <#if mkey=='pirce'>
							        	 ${obj[mkey]!}￥
							        <#elseif mkey=='stock'>
							        	<#if (obj[mkey]!)== '0'>
							        		<span class="red"><i class="glyphicon glyphicon-warning-sign"></i></span>缺货
							        	<#else>
							        		有货
							        	</#if>
				   			    	<#else>
				   			    		<#if (obj[mkey]!)?length lt 6>   
											${obj[mkey]!}
										<#else> 
										     ${obj[mkey][0..10]}...
										</#if>
					   			    </#if>
					   	 	   </#list>
			   			    </td>
					   	 	   <td class="col-xs-5">
									<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
										<#if session.master.manager=='1'>
										<a id="mas_" class="green" href="${ctx}/goods/gotoUpdate/${obj.goodsid!}" openMode="rightPage" title="修改">
											<i class="glyphicon glyphicon-pencil bigger-130" ></i>
										</a>
										<a id="mas_list_del" class="red" href="javascript:void(0);" title="删除" onclick="if(confirm('确定要删除吗？')){ajaxRefresh('${ctx}/goods/deleteGoods/${obj.goodsid!}','${ctx}/goods/getGoodsList');}">
											<i class="glyphicon glyphicon-trash bigger-130" ></i>
										</a>
										</#if>
										<#if (obj['stock']!)!= '0'>
										<input id="min_${obj['goodsid']}" goodsid="${obj['goodsid']}" onClick="" type="button" value="-"  style="height:20px;"/>  
										<input id="text_box_${obj['goodsid']}" name="pirce_sum" pirce="${obj['pirce']}" size="1" type="text" value="1"  style="height:20px;"/>  
										<input id="add_${obj['goodsid']}" goodsid="${obj['goodsid']}" type="button" value="+"  style="height:20px;"/>  
										<a id="buyGoods_${obj['goodsid']}" class="blue" style="cursor:pointer;" goodsid="${obj['goodsid']}"  openMode="rightPage" title="加入购物车">
											<i class="glyphicon glyphicon-saved" ></i>
										</a>
										</#if>
									</div>
								</td>
					   	 	   
						   </tr>
					   </#list>
				   </tbody>
				</table>
				 -->
			</div>
			
		<!-- 列表结束 -->
		<div class="modal-footer no-margin-top ">
			<!-- 按钮 位置 待用 -->
			<div class="col-xs-6">
		    	<table> 
					<tr> 
					<td align="left">在线客服：
					<a target=blank href="tencent://message/?uin=276979375&Site=qq&Menu=yes"><img border="0" SRC="http://wpa.qq.com/pa?p=1:276979375:4" alt=" 客 服 " />&nbsp;</a></td> 
					</tr>
				</table> 
		    </div>
		</div>
		</form>
	<!-- PAGE CONTENT ENDS -->
	</div>
</div>
</body>
<script type="text/javascript">

$(function(){  
	$("#span_menuTwoLevel").html("手机报价");
	$('input, textarea').placeholder();
	//$("#shoppingsum").text(${shoppingsum!});
    $("input[id*='add']").click(function(){
    	var goodsid = $(this).attr("goodsid");
	    var t = $("#text_box_"+goodsid);
    	t.val(parseInt(t.val())+1);
        //setTotal(goodsid,t);  
    })  
    $("input[id*='min']").click(function(){
    	var goodsid = $(this).attr("goodsid");
	    var t = $("#text_box_"+goodsid);
    	var num = parseInt(t.val())-1;
        if(num>=0){
        	t.val(num);
            //setTotal(goodsid,t);  
        }
    })  
    function setTotal(goodsid,t){
    	var pirce = t.attr("pirce");
        $("#total_"+goodsid).html((parseInt(t.val())*pirce).toFixed(2));  
    }  
    //setTotal();  
    
    $("a[id*='buyGoods']").click(function(){
    	var goodsid = $(this).attr("goodsid");
	    var _num = $("#text_box_"+goodsid).val();
	    var _pirce = $("#text_box_"+goodsid).attr("pirce");
	    
	    document.getElementById('form_query').action='${ctx}/goods/saveShop?goodNum='+_num+'&pirce='+_pirce+'&goodsId='+goodsid;
		ajaxSubmitAndRefresh('form_query','${ctx}/goods/getGoodsList');
    })  
})
</script>
</html>
